package bTree.LeetCode;

public class 盛最多水的容器 {
    public int maxArea(int[] height) {
        int result=0;
        int length = height.length;
        int left=0,right=length-1;
        while (left<right){
            result=Math.max(result,(right-left)*Math.min(height[left],height[right]));
            if(height[left]>=height[right]){
                right--;
            }else {
                left++;
            }
        }
        return result;
    }
}